package net.lzzy.tapDemo;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

import java.util.Arrays;
import java.util.List;

public class IntersectionTest {
    public static void main(String[] args) {
        SparkConf conf = new SparkConf().setAppName("SparkTextFile").setMaster("local");
        JavaSparkContext javaSparkContext = new JavaSparkContext(conf);
        JavaRDD<Integer> javaRDD = javaSparkContext.parallelize(Arrays.asList(1,3,4,5,6,5));
        JavaRDD<Integer> javaRDD1 = javaSparkContext.parallelize(Arrays.asList(1,3,4,5,6,5));
        JavaRDD<Integer> union = javaRDD.intersection(javaRDD1);
        List<Integer> collect = union.collect();
        for (Integer integer : collect) {
            System.out.println(integer);
        }
    }
}
